﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/base.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-2.1.1.min.js"></script>
    <script src="~/Content/bootstrap/js/bootstrap.js"></script>
    <script src="~/Scripts/layer/layer.js"></script>
    <script src="~/Scripts/qrcode.js"></script>
    <title>邀请</title>
    <style type="text/css">
        body {
            font-family: arial, '宋体';
            background: white;
        }

        .container-fluid {
            margin: 0;
            padding: 0;
            text-align: center;
        }

        .btn_ok {
            background-color: #F3A433;
            border: none;
            color: white;
        }

        #update_pass {
            background-color: #F3A433;
            text-align: center;
            font-weight: bold;
            font-size: 20px;
            width: 100%;
            height: 60px;
            line-height: 60px;
        }

        #txt_password {
            margin-top: 15%;
        }

        .container-fluid {
            margin: 0;
            padding: 0;
        }

        #content_sel {
            text-align: left;
        }
        #div_mobile input {
         width:70%;
        }
    </style>
    <script>
        $(function () {
            
            if ('@ViewData["result"]' == "0")//表示登录没有过期
            {
                $("#div_mobile").remove();
                var qrcode = new QRCode(document.getElementById("qrcode"), {
                    width: 240,//宽度
                    height: 240
                });
                qrcode.makeCode(window.location.href);
                $("#link_url").val(window.location.href);

                times("1")
            } else {
                $("#div_mobile").show();
                $("#div_pc").remove();
                times("2")

            }
       
        });
        function times(obj)
        {
            var housr = '@ViewData["hours"]';
            var secons = parseInt(housr);
            if (obj == "1") {
                setInterval(function () {
                    secons--;
                    $(".sp_time").text(secons);

                }, 1000)
            } else {
                setInterval(function () {
                    secons--;
                    $(".sp_times").text(secons);

                }, 1000)
            }
        }
        function share() {
            $("#sharePic").show();
        }
        function Myselect_txt() {
            if ($("#link_url").focus) {
                $("#link_url").select();
            }

        }
        function CheckInputNullAll(demo) {
            var pattern = /(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7}/;
            var card = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
            var flag = true;
            var inp = $("#" + demo + "").find("input[type='text'],input[type='number']");
            $(inp).each(function (m, n) {
                if ($(n).hasClass("required") == true && $(n).val() != "") {
                    if ($(n).hasClass("tel")) {
                        if (!pattern.test($(n).val())) {
                            layer.msg($(n).attr("placeholder"), { icon: 5 });
                            flag = false;
                            return flag;
                        }
                    }
                    if ($(n).hasClass("sfz")) {
                        if (!card.test($(n).val())) {
                            layer.msg($(n).attr("placeholder"), { icon: 5 });
                            flag = false;
                            return flag;
                        }
                    }
                } else if ($(n).hasClass("required") == true && $(n).val() == "") {
                    layer.msg($(n).attr("placeholder"), { icon: 5 });
                    flag = false;
                    return flag;

                } else {
                    return flag;
                }


            })
            return flag;

        }
        function sq_click() {

            if (CheckInputNullAll("div_mobile")) {
                var txt_name = $("#txt_userName").val();
                var txt_companyName = $("#txt_companyName").val();
                var txt_contract_name = $("#txt_contartName").val();
                var txt_mobile = $("#txt_mobile").val();
                var txt_qqCode = $("#txt_qq").val();
                var txt_wxopen = $("#txt_wxCode").val();
                var txt_wwCode = $("#txt_wxCode").val();
                var txt_idcard = $("#txt_idcard").val();
                var txt_shopurl = $("#txt_shopurl").val();
                $.ajax({
                    type: "POST",
                    url: "/Share/OpeaAgency",
                    dataType: "json",
                    data: { "id": 0, "sh_id": '@ViewData["id"]', "Name": txt_name, "companyName": txt_companyName, "contract_name": txt_contract_name, "mobile": txt_mobile,"qq_code": txt_qqCode, "wxOpenid": txt_wxopen, "wwCode": txt_wwCode, "idCard": txt_idcard, "shopUrl": txt_shopurl },
                    success: function (data) {
                        if (data.MessageCode == "0") {
                            layer.msg("申请成功,请等待审核！");
                            setTimeout(function () {
                                window.location.href = "/Login/Login";
                            }, 2000)
                        } else if (data.MessageCode == "50") {
                            layer.msg("信息存在重复!");
                        } else {
                            layer.msg( "申请失败！");
                        }
                    }
                });
            }


        }
    </script>
</head>
<body>
    @{
        if (@ViewData["flags"] == "0")
        { 
        <input type="hidden" value="@ViewData["nonceStr"]" id="nonceStr" />
       <div class="div_mobile" id="div_mobile" style="display:none;">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12" id="update_pass">
                    <span style="text-align:center;color:white;">新用户申请</span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="margin-top:10px;">
                 <h3>@ViewData["level_name"] </h3>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="margin-top:10px;">
                    商家名称：<input type="text" id="txt_userName" placeholder="请输入商家名称" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    公司名称：<input type="text" id="txt_companyName" placeholder="请输入公司名称" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    联&nbsp;&nbsp;系&nbsp;&nbsp;人：<input type="text" id="txt_contartName" placeholder="请输入联系人" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    手&nbsp;&nbsp;机&nbsp;&nbsp;号：<input type="text" id="txt_mobile" placeholder="请输入正确的手机号码" class="tel required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    &nbsp;&nbsp; QQ&nbsp;&nbsp;号：<input type="text" id="txt_qq" placeholder="请输入QQ号" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    微&nbsp;&nbsp;信&nbsp;&nbsp;号：<input type="text" id="txt_wxCode" placeholder="请输入微信号" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    旺&nbsp;&nbsp;旺&nbsp;&nbsp;号：<input type="text" id="txt_wwcode" placeholder="请输入旺旺号" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    身份证号：<input type="text" id="txt_idcard" placeholder="请输入正确的身份证号" class="sfz" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    店铺网址：<input type="text" id="txt_shopurl" placeholder="请输入店铺网址" class="required" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" >
                    <input type="button" id="btn_sq" onclick="sq_click();" value="提交申请" style=" margin-left:20%;width: 30%; height: 30px; border: 0px; text-align: center; background-color: #F3A433; color:white; border-radius: 4px; " />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="margin-top:10px;">
                    <span>距离过期时间还有:</span>
                    <span class="sp_times" style=" color:red;"></span>秒
                </div>
            </div>
        </div>

          
    </div>
    <div class="div_pc" id="div_pc">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12" id="update_pass">
                    <span style="text-align:center;color:white;">邀请新用户</span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <div>我是<span>@ViewData["username"]</span> </div><br />
                    <div style="padding-top:15px;">我为自己代言</div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="padding-top:20px;">
                    <div class="span2"></div>
                    <div id="qrcode" class="span8">
                    </div>
                    <div class="span2"></div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="padding-top:20px;">
                    <span>快来扫一扫</span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12" style="margin-top: 10px; margin-bottom: 10px;">
                    <span><input type="text" id="link_url" style="border: 0px; width:85%; height: 30px; text-align: center" onclick="Myselect_txt();" /></span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <span><input type="button" id="btn_link" onclick="share();" style="width: 30%; height: 30px; border: 0px; text-align: center; background-color: #F3A433; color:white; border-radius: 4px; " value="点击分享" /></span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12"  style="margin-top:10px;">
                    <span>距离过期时间还有:</span>
                    <span class="sp_time" style=" color:red;"></span>秒
                </div>
            </div>
        </div>


    </div>
         <div id="sharePic" class="sharePic" style="display:none;" onclick="$(this).hide();">
               <img src="~/Content/images/share.png" />
           </div>
           <div class="serp_quick_but">
               <a id="ab" class="quick_menu"></a>
               <a href="../Home/Index" id="a1" class="quick_menu_back small"><span>首页</span></a>
               <a href="../Certificate/Index" id="a2" class="quick_menu_fahuo small"><span>证书</span></a>
               <a href="../Examine/Index" id="a4" class="quick_menu_clienk small"><span>用户</span></a>
               <a href="../WechartShare/Index" id="a4" class="quick_menu_clienk small"><span>邀请</span></a>
               <a href="../Sqauthorization/Index" id="a3" class="quick_menu_shaom small"><span>申请</span></a>
               <a href="../Password/Index" id="a4" class="quick_menu_clienk small"><span>密码</span></a>
               <a href="../Login/ClearSession" id="a5" class="quick_menu_follow small"><span>退出</span></a>
           </div>

    <style type="text/css">
        .sharePic {
            position: fixed;
            top: 0;
            left: 0;
            z-index: 2000;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            text-align: right;
        }

            .sharePic.on {
                display: block;
            }

            .sharePic img {
                margin-top: 10px;
                margin-right: 30px;
                width: 160px;
            }

        .serp_quick_but {
            position: fixed;
            width: 300px;
            height: 52px;
            bottom: 0px;
            right: 5px;
        }

            .serp_quick_but a {
                display: block;
                position: absolute;
                text-align: center;
                text-decoration: none;
            }

                .serp_quick_but a span {
                    font-size: 12px;
                    line-height: 94px;
                    color: #000;
                }

        a.small {
            width: 32px;
            height: 32px;
            background: #d5d5d5;
            border-radius: 30px;
            border: 2px solid #fff;
            background: url(../Content/images/pic02.png) no-repeat rgba(0,0,0,0.4);
            background-size: auto 69px;
        }

        a:hover.small {
            border: 2px solid #fc4e2b;
            background: #fff;
        }

        .serp_quick_but a.quick_menu {
            right: 5px;
            top: 0px;
            width: 30px;
            height: 30px;
            background: url(../Content/images/pic02.png) no-repeat;
            background-size: auto 30px;
        }

        .serp_quick_but a.quick_menu_back {
            right: 55px;
            top: -5px;
            background-position: -69px -18px;
            display: none;
        }

        .serp_quick_but a.quick_menu_fahuo {
            right: 105px;
            top: -5px;
            background-position: -100px -18px;
            display: none;
        }

        .serp_quick_but a.quick_menu_shaom {
            right: 155px;
            top: -5px;
            background-position: -137px -18px;
            display: none;
        }

        .serp_quick_but a.quick_menu_clienk {
            right: 205px;
            top: -5px;
            background-position: -169px -18px;
            display: none;
        }

        .serp_quick_but a.quick_menu_follow {
            right: 255px;
            top: -5px;
            background-position: -209px -18px;
            display: none;
        }
    </style>
    <script>
        //左下方导航
        $(function () {
            var i = 0;
            $("#ab").click(function () {
                i++;
                if (i % 2 == 0) {
                    $("#a1").hide();
                    $("#a2").hide();
                    $("#a3").hide();
                    $("#a4").hide();
                    $("#a5").hide();
                }
                else {
                    $("#a1").show();
                    $("#a2").show();
                    $("#a3").show();
                    $("#a4").show();
                    $("#a5").show();
                }
            })
        })
    </script>
        
        }else if(@ViewData["flags"] =="10") 
        {
        
         <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12" id="update_pass">
                    <span style="text-align:center;color:white;">新用户申请</span>
                </div>
                <div class="span12">
                   <h2>此链接已过期！</h2>
                </div>
            </div>
             </div>
        }
        else if (@ViewData["flags"] == "20") 
        {
        
         <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12" id="update_pass">
                    <span style="text-align:center;color:white;">新用户申请</span>
                </div>
                <div class="span12">
                   <h2>此链接已经被使用过！</h2>
                </div>
            </div>
             </div>
        }
        else
        {
        
         <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12" id="update_pass">
                    <span style="text-align:center;color:white;">新用户申请</span>
                </div>
                <div class="span12">
                    <h2>此链接不存在!</h2>
                </div>
            </div>
             </div>
        }
        
        
        
    }
    
</body>
</html>
